//
// Created by cuichao on 2023/3/6.
//

#ifndef WSSERVER_HOST_H
#define WSSERVER_HOST_H

#include <string>
#include <nlohmann/json.hpp>
#include <utility>

using namespace std;
struct DHost {
    std::string Position;
    int Address;
    int PointCount;
    std::vector<std::string> PointNames;
};

NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(DHost, Position, Address, PointCount, PointNames)


struct DetectorValue {
    std::string workShop;
    std::string name;
    std::string type;
    std::string value;

    DetectorValue() = default;
    DetectorValue &operator=(const DetectorValue &dv) = default;

    DetectorValue(DetectorValue &&dv) noexcept: workShop(std::move(dv.workShop)), name(std::move(dv.name)),
                                                type(std::move(dv.type)), value(std::move(dv.value)) {
    }

    DetectorValue(const DetectorValue &dv) {
        workShop = dv.workShop;
        name = dv.name;
        value = dv.value;
        type = dv.type;
    }

    DetectorValue(string w, string n, string t, string v) : workShop(std::move(w)), name(std::move(n)), type(std::move(t)),
                                                           value(std::move(v)) {
    }
};

NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(DetectorValue, workShop, name, type, value)

struct PushData {
    bool success;
    std::string errmsg;
    std::vector<DetectorValue> detectorValues;
};

NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(PushData, success, errmsg, detectorValues)

#endif //WSSERVER_HOST_H